package com.hisoft.entity;

import java.util.List;

import org.apache.log4j.Logger;

import com.hisoft.type.ResultEnum;

public class Import extends ABaseTag {
	Logger logger = Logger.getLogger(Import.class);
	//src标签的值
	private String scr;
	//倒入的操作对象
	private List<ABaseTag> importXML;

	public List<ABaseTag> getImportXML() {
		return importXML;
	}

	public void setImportXML(List<ABaseTag> importXML) {
		this.importXML = importXML;
	}

	public String getScr() {
		return scr;
	}

	public void setScr(String scr) {
		this.scr = scr;
	}

	public Import() {
		append(this.getClass().getName());
	}

	@Override
	public String toString() {
		String str = "Import ";
		for (Object o : importXML) {
			str += o.toString() + "\n";
		}
		return str;
	}

	@Override
	public String excute() {
		beforeExcute();
		logger.info(toString());
		boolean flag = true;
		for (ABaseTag temp : importXML) {
			flag = flag & (temp.excute().contains("" + ResultEnum.PASS));
		}
		if (flag == true) {
			setResult(ResultEnum.PASS);
			return "" + ResultEnum.PASS;
		} else {
			return "" + flag;
		}
	}

}
